<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div class="lineChart" id="all_main" style="width: 600px;height:400px;"></div>
<script type="text/javascript" src="/static/js/echarts.min.js"></script>
<script>
    var myChart = echarts.init(document.getElementById('all_main'));

    $.ajax({
        type:'post',
        url:'/admin/stat/getJsonRec.html',
        data:{},
        dataType:'json',
        success:function(data){
            var ArrNum = [];
            var amountArr = [];
            //console.log(data);
            var data = data;
            $.each(data,function(i,o){
                var obj = o.type_name;
                var amount = o.pay_amount;
                ArrNum.push(obj);
                amountArr.push(amount);
            });
            myChart.setOption({ //加载数据图表
                xAxis: {
                    data: ArrNum
                },
                series: {
                    data: amountArr
                }
            });
        }
    });

    // 指定图表的配置项和数据
    var option = {
        color: ['#3398DB'],
        title: {
            text: '各通道充值量'
        },

        tooltip : {
            trigger: 'axis',
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis : [
            {
                type : 'category',
                data : [],
                axisTick: {
                    alignWithLabel: true
                }
            }
        ],
        yAxis : [
            {
                type : 'value'
            }
        ],
        series : [
            {
                name:'充值量',
                type:'bar',
                barWidth: '60%',
                data:[]
            }
        ]
    };

    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
</script>
</body>
</html>